import { http } from "./http";

/** 获取班级 */
export function getClass() {
    return http.get('/classroomlist');
}
/** 获取课程 */
export function getCourse(classroomId: number) {
    return http({
        method: 'get',
        url: '/courselist',
        params: { classroomId }
    })
}

/** 获取验证码 */
export function getCaptcha() {
    return http({
        method: 'get',
        url: '/captcha.jpg',
        responseType: 'arraybuffer'
    })
}
/** 获取验证码Id */
export function getCaptchaID() {
    return http.get('/sseintoken');
}

/** 登录 */
export function login(account: string, password: string,class_id:string,curse_id:string, captcha: string, sseintoken: string) {
    return http({
        method: 'post',
        url: '/login',
        params: {
            account,
            password,
            class_id,
            curse_id,
            captcha,
            sseintoken
        }
    })
}

/** 注册 */
export function register(account: string, password: string,name:string,avatar:string, classroomId: string, courseId: string) { 
    return http({
        method: 'post',
        url: '/register',
        params: {
            account,
            password,
            name,
            avatar,
            classroomId,
            courseId
        }
    })
}